{% extends "./base.html" %}

{% block page_header %}
  <h3>Topic: {{ topic }}</h3>
{% endblock page_header %}

{% block content %}

  <p>Entries:</p>
  <p>
    <a href="{% url 'learning_logs:new_entry' topic.id %}">Add new entry</a>
  </p>
  {% for entry in entries %}
    <div class="card">
      <div class="card-header">
        {{ entry.date_added|date:'Y 年 m 月 d 日, H:i' }}
      </div>
      <div class="card-body">
        <p class="card-text">{{ entry.text|linebreaks }}</p>
        <a href="{% url 'learning_logs:edit_entry' entry.id %}" class="btn btn-primary">Edit this entry</a>
      </div>
    </div>
  {% empty %}
    <p>There are no entries for this topic yet.</p>
  {% endfor %}
{% endblock content %}
